package com.ruoyi.blindBoxManage.mapper;

import com.ruoyi.blindBoxManage.domain.BlindBox;
import com.ruoyi.blindBoxManage.domain.Box;
import com.ruoyi.common.vo.MiddleRightDataResponseVo;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * 盲盒配置Mapper接口
 * 
 * @author ruoyi
 * @date 2025-08-12
 */
public interface BlindBoxMapper 
{
    /**
     * 查询盲盒配置
     * 
     * @param id 盲盒配置主键
     * @return 盲盒配置
     */
    public BlindBox selectBlindBoxById(Long id);

    /**
     * 查询盲盒配置列表
     * 
     * @param blindBox 盲盒配置
     * @return 盲盒配置集合
     */
    public List<BlindBox> selectBlindBoxList(BlindBox blindBox);

    /**
     * 新增盲盒配置
     * 
     * @param blindBox 盲盒配置
     * @return 结果
     */
    public int insertBlindBox(BlindBox blindBox);

    /**
     * 修改盲盒配置
     * 
     * @param blindBox 盲盒配置
     * @return 结果
     */
    public int updateBlindBox(BlindBox blindBox);

    /**
     * 删除盲盒配置
     * 
     * @param id 盲盒配置主键
     * @return 结果
     */
    public int deleteBlindBoxById(Long id);

    /**
     * 批量删除盲盒配置
     * 
     * @param ids 需要删除的数据主键集合
     * @return 结果
     */
    public int deleteBlindBoxByIds(Long[] ids);

    @Select("select id from t_blind_box where name = #{name}")
    Long selectIdByName(@Param("name") String name);
    @Select("select name from t_blind_box where id = #{id}")
    String selectNameById(@Param("id")Long id);

    @Select("select count(*) from t_blind_box where play_type_id = #{playTypeId}")
    Integer selectCountByPlayTypeId(@Param("playTypeId") Integer playTypeId);

    @Select("select count(*) from t_blind_box where class_id = #{classId}")
    Integer selectCountByClassId(@Param("classId") Integer classId);

    List<MiddleRightDataResponseVo> middleRightData(@Param("sort") Integer sort);

}
